home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / hplj3j11.zip / HPLJ-III.TXT < prev    next >
Text File  |  1991-09-02  |  47KB  |  825 lines

  1. Hewlett-Packard LaserJet III/IIID printer driver for Sprint version 1.0x
  2.  
  3. By Allen Brunson  06/28/91
  4. Revised by James R. Celoni  9-2-91
  5.  
  6.  
  7. See the README.TXT file for an explanation of the contents of each file
  8. included.
  9.  
  10. Warning!  Don't load this document into Sprint and then print it!  It's
  11. full of examples of at-sign commands that Sprint will try to translate at
  12. print time!
  13.  
  14.  
  15. INTRODUCTION
  16.  
  17. This is a Sprint printer driver for the LaserJet III.  It also supports the
  18. duplexing feature of the LaserJet IIID.  I haven't tried it, but I strongly
  19. suspect this driver would also work on Hewlett-Packard's new LaserJet
  20. IIIsi, and that with its duplexing option installed, my IIID duplexing
  21. support would work on it as well.
  22.  
  23. I wrote this driver after downloading several from CompuServe and found
  24. them all to be hopelessly inadequate.  (How many times have you read
  25. something like that at the start of a customized printer driver?  It
  26. reflects the DIY spirit of personal computers, I suppose.)  Most problems
  27. were small and easily fixed -- except for the proportional spacing tables. 
  28. Typically, the drivers' PSTs were way off, didn't include all the ASCII
  29. values, or a separate PST for each attribute combination (regular, bold,
  30. italic, and bold-italic) wasn't provided (all four attribute combinations
  31. are indeed different).  So I "rolled my own."  I have Sprint version 1.00
  32. and Jim has version 1.01; the driver has been tested with both versions.
  33.  
  34. Like all the drivers I downloaded, you may find this one hopelessly
  35. inadequate for you in some way or another.  If so, feel free to cannibalize
  36. my PST tables or any other element you like and combine it with your
  37. favorite parts of other drivers.  Customization is the only way to get
  38. exactly what you want.
  39.  
  40.  
  41. DESIGN PHILOSOPHY
  42.  
  43. I use Sprint for correspondence, lengthy manuscripts, and very little else. 
  44. I'm very fond of typeset-quality enhancements, such as duplexing, justified
  45. right margins, distinct open and close quotation marks, kerning, and
  46. ligatures.  I think this bias shows in the printer driver I created.
  47.  
  48. This printer driver contains very complete PST tables for both of the
  49. LaserJet III's built-in proportional and scalable fonts, Times and Univers. 
  50. These PST tables are EXACTLY CORRECT, down to the last pixel, for every
  51. printing ASCII character (values 32 to 255) in the PC-8 character set at 12
  52. points.  This is an absolute necessity if Sprint is expected to do accurate
  53. justification and kerning.  The methods I used to achieve this level of
  54. perfection are revealed in a later section of this file, Printer Driver
  55. Tools.
  56.  
  57. This printer driver includes a new and revolutionary technique to almost
  58. completely eliminate scaling errors introduced when the LaserJet III's
  59. fonts are scaled to different sizes.  If the Sprint users on Borland's
  60. CompuServe Sprint forum are any indication, this is the first printer
  61. driver of its kind anywhere.  This method will be covered in greater detail
  62. in a later document section called Notes on Using Scalable Fonts (The 1800
  63. DPI Lie), but to summarize, this printer driver convinces Sprint that the
  64. LaserJet III can print at 1800 dpi (when it can really only print at 300
  65. dpi).  This is the same trick that the Sprint PostScript printer drivers
  66. use to make fonts scale smoothly on PostScript devices.
  67.  
  68. Most printer drivers are based primarily on the Roman-8 character set,
  69. because of the fact that it has prettier quotation marks, I guess. 
  70. Personally, I am a big proponent of the PC-8 character set for the simple
  71. reason that it is the same "character set" used by the text-mode video
  72. displays produced by every IBM-PC compatible computer ever made, which also
  73. means that the line-drawing characters are included (they aren't in the
  74. Roman-8 character set).  In short, if you're using the printer's PC-8
  75. character set, when you see a certain character on-screen for a given ASCII
  76. value, you will see that same character on the printer for that value as
  77. well.  I make almost exclusive use of the printer's PC-8 character set in
  78. my printer driver.  The HPLJ3J driver also allows use of the Roman-8 and
  79. Legal symbol sets.  The Legal symbol set includes characters like trademark,
  80. registered trademark (R inside a circle), and copyright.
  81.  
  82. That isn't to say that I don't like pretty quotation marks.  Far from it. 
  83. In fact, when you also use my enclosed formatter macros, this printer
  84. driver automatically produces open and close quotation marks in the two
  85. proportional fonts.  (You don't have to make any changes to the quotation
  86. marks in your document for this to work.)  I get around the problem of
  87. these characters not being available in the PC-8 set by making use of a
  88. little-known character set on the LaserJet III called Microsoft Publishing. 
  89. I use only 24 characters from this set; four of them are open and close
  90. double quotation marks and open and close single quotation marks.
  91.  
  92. Another benefit of using the Microsoft Publishing character set is the
  93. automatic support of ligatures (see a later section called Notes on
  94. Ligatures for more information).  Ligatures only work in Times and Helvetica. 
  95. Formatter macros automatically substitute the ligature characters; you
  96. don't have to type anything special in your document.
  97.  
  98. A word about fonts.  The LaserJet III includes only four font families:
  99. Courier, LinePrinter, CG Times, and Univers.  The first two are monospaced
  100. and come in very limited type sizes; the last two are proportional and
  101. scalable to any point size from .25 point all the way up to 999.75 point,
  102. but this printer driver only uses integer point values.)  In the driver, CG
  103. Times is called Times, and Univers is called Helvetica, because many PCL
  104. printers (like the LaserJet III) also do PostScript (maybe with a cartridge),
  105. and using the same names for fonts that look so much alike allows for printing
  106. the same documents using different printer drivers with minimal changes to
  107. the documents (or none at all).
  108.  
  109. Many printer drivers have a font list as long as your arm, including an entry
  110. for nearly every combination of font size, attributes, and character set,
  111. all with fairly cryptic names like Times12PCBold.  In my mind, this is a
  112. mistake.  My font list has five entries, only one more than the number of
  113. font families.  (The fifth is a second Courier type, which was unavoidable,
  114. as we shall see.)  This doesn't prevent you from using any type size you
  115. want (with the two scalable fonts), and it also doesn't prevent you from
  116. using useful type attributes like boldface, italics, superscript, and
  117. subscript, it just puts them in their proper place.  I like things to be as
  118. simple as possible.
  119.  
  120. I included support for duplex printing, but I left landscape printing out
  121. entirely.  The other LaserJet III drivers I've seen only support LinePrinter
  122. and Courier in landscape; frankly, what's the point?  I have access
  123. to a nice, wide carriage OkiData for stuff like that.  The LaserJet III is
  124. supposed to be able to rotate its fonts, so in theory it should be possible
  125. to include the "good" fonts in a landscape driver, but I haven't pursued
  126. this yet.  Perhaps in a later version of this printer driver.
  127.  
  128. Kerning is supported through formatter translations.  Actually, I didn't
  129. have to do a thing to make this work except co-opt all the kerning
  130. character pairs out of POSTSCR.TCT, Sprint's enhancement file for
  131. PostScript printers.  Finally, two dashes right together, such as --, are
  132. translated into an "em-dash," a dash that is much longer than the average
  133. one, about the length of an upper-case M.
  134.  
  135. In case you're thinking about customizing this driver or writing one of
  136. your own (perhaps for a font cartridge) but feel daunted because you think
  137. you don't have access to the right materials and tools to do so, fret no
  138. more.  I created this printer driver using only other printer drivers (as a
  139. starting point), a LaserJet IIID and its manuals, and Sprint itself.  If
  140. you're interested in this type of thing, see a later section in this
  141. document called Printer Driver Tools.
  142.  
  143.  
  144. INSTALLING THE PRINTER DRIVER
  145.  
  146. Put a copy of the files SP-SETUP.EXE (provided with Sprint) and the files
  147. HPLJ3J.SPL (provided here as the main file of this printer driver) and
  148. MAIN.SPL together on a diskette or in a subdirectory.
  149.  
  150. Run SP-SETUP to install the printer driver.  It will ask you lots of
  151. questions about disk types and directories; if in doubt, consult your
  152. Sprint manuals.  When you get to the main menu, select Printer
  153. Installation, then Hewlett-Packard, then LaserJet III.  The choices you'll
  154. get are Simplex, which will print on one side of the page and works with
  155. either the LaserJet III or IIID; and Duplex, which prints on both sides of
  156. the page in portrait orientation and therefore only works with the IIID.
  157.  
  158. I suggest you use Courier as the default font when installing these
  159. drivers.  Further explanation for this is given in a later section, Using
  160. the Printer Driver.
  161.  
  162. If you have a LaserJet IIID, you can install both of these printer drivers
  163. at once, using Simplex to print on only one side of the page and Duplex to
  164. print on both.
  165.  
  166. When installing the drivers, you have to give them an eight-character DOS
  167. filename.  Remember or write down which name you assigned to each driver,
  168. because once you're inside Sprint you won't get any further help as to
  169. which printer driver might do what.
  170.  
  171. A quick note on customizing the margins.  By default, Sprint prints
  172. everything with a one inch margin all around, which I happen to like.  My
  173. first version of this driver had too little space in the left and top
  174. margins and too much in the bottom and right ones.  So I added a couple of
  175. custom lines to my driver, which are probably specific to the page
  176. registration on my particular printer, which might be different on yours. 
  177. To tweak these values, there are several values in HPLJ3J.SPL you can
  178. change.  They are all very near the top of the file.
  179.  
  180. To make the left margin bigger (and the right one smaller), or vice versa,
  181. you can change the "leftm" parameter.  It is currently set to 3.  A smaller
  182. value will decrease the left margin; larger will increase it.  The unit of
  183. measure here is columns, unfortunately; you can't be too precise.
  184.  
  185. You can be much more picky when changing the top and bottom margins.  The
  186. first available option is the "topm" parameter, given in lines.  It is
  187. currently set to 1.  Setting it to 0 would give a smaller top margin and a
  188. larger bottom margin; making it bigger would have the opposite effect. 
  189. This is the "official" top margin that Sprint knows about.
  190.  
  191. The other way to tweak the top margin is with the command in the file that
  192. reads like this:
  193.  
  194. page ^[*p60Y^M,
  195.  
  196. This is a command that Sprint will send at the beginning of every page. 
  197. You're supposed to use the "page" command for things like doing something
  198. different on odd and even pages, but I cheated a little.  The command tells
  199. Sprint to move down 60/300ths of an inch at the start of every page it
  200. prints before doing anything else.  You can change the 60 to any other
  201. value you want.  Note that Sprint isn't aware that this will have an effect
  202. on the top margin, so use this command with care.
  203.  
  204. If you change these values, you have to reinstall the printer driver for
  205. them to take effect.
  206.  
  207. If you want to use the typeset-quality enhancements this printer driver
  208. provides, such as kerning, ligatures, and automatic open and close quotes,
  209. continue the installation with the next section.
  210.  
  211.  
  212. INSTALLING THE FORMATTER MACROS
  213.  
  214. For Sprint to be able to fully utilize the resources provided by this
  215. printer driver, it has to be given the smarts to do so.  This is done
  216. through the use of formatter macros.  Following are suggestions for
  217. incorporating these macros into your Sprint setup.  If you're an
  218. experienced Sprint user, you can probably just dive right in and put the
  219. macros in HPALLEN.TCT and EXTRA.FMT to work, picking and choosing the
  220. parts you like.
  221.  
  222. I suggest you make a copy of the standard format file that comes with
  223. Sprint, STANDARD.FMT, and call it something else, say, HPLJ-III.FMT.  It's
  224. probably best to start with a fresh copy right off of the Sprint
  225. distribution disks.  Then, at the bottom of the file, somewhere BEFORE the
  226. line that says "@style(comments no)", insert all the stuff from the file
  227. supplied with this driver called HPALLEN.TCT.  This can set the default
  228. font (e.g., to 12 point Times), enable Sprint to translate single and double
  229. quotation marks into their typeset-looking open and close equivalents,
  230. enable double dash to em-dash translations, and turn on kerning and
  231. ligatures.  If you don't want one or more of these features, just comment
  232. out or remove the sections you don't like.  There are comments in the TCT
  233. file explaining what each part does.
  234.  
  235. Finally, there are a few changes to some of the Sprint formats in EXTRA.FMT
  236. that you might care to use.  Included is a change to make the Large
  237. attribute print at twice the point size of whatever the current type size
  238. is, a change to make the Footnote style use 10 point type, and a change to
  239. the Bullets list type to make it use a couple of the "real" round and
  240. diamond shaped bullets from the Microsoft Publishing character set.  (The
  241. printer driver test file, HPLJ-III.SPR, assumes that the bullet change is
  242. made.  It won't hurt anything if it's not; a few things just won't look
  243. the same.)
  244.  
  245. The tricky part is that these changes have to be inserted into the new
  246. HPLJ-III.FMT file at the point where these formats were originally defined,
  247. and not just added to the end, because some other formats use these formats
  248. as part of their definition.  You also have to comment out or remove the
  249. original definition.  I leave it up to you to find the original definitions
  250. in the file and replace them, if you wish.  When you're finished, save the
  251. HPLJ-III.FMT file in your Sprint directory.
  252.  
  253. Now you have a fully prepared format file called HPLJ-III.FMT that will
  254. really make your LaserJet III sing.  It won't automatically be used unless
  255. you tell Sprint to do so, however.  This is covered in the next section,
  256. Using the Printer Driver.
  257.  
  258.  
  259. USING THE PRINTER DRIVER
  260.  
  261. At this point, it is assumed that you have installed at least one of the
  262. printer drivers (Simplex or Duplex or both), that you made Courier the
  263. default font, and that you have created a special format file called
  264. HPLJ-III.FMT.  All of this was described in previous sections.  It also
  265. assumes that you're using the Sprint advanced user interface.
  266.  
  267. If you create a Sprint document with no special formatting commands and no
  268. typeface commands, you will get regular old monospaced 12-point Courier
  269. output with one inch margins all around.  None of the typeset-quality
  270. enhancements discussed thus far will be in effect.  It's like you're using
  271. an old original LaserJet, circa 1984.  This is a good mode for printing
  272. text files, program source files, or dashing off a quick note.  (If you
  273. print stuff with long lines that you'd like not to wrap, Courier10 might be
  274. a better default font choice.)
  275.  
  276. When you're ready to create a typeset-quality document, however, use the
  277. HPLJ-III.FMT file.  To do this while editing in Sprint, go through the
  278. menus like this:  F10/Layout/Document-Wide/Style Sheet.  Then enter HPLJ-III
  279. as your format name.  The default font and size will be set as you specified
  280. in the file (e.g., to 12-point Times), and all the typeset-quality enhancements
  281. will be in effect.  To see these effects in action, load the included file
  282. HPLJ-III.SPR into Sprint, examine it, then print it out.  (It's set up
  283. expecting to find HPLJ-III.FMT.)  It contains examples of many enhancements
  284. discussed in this file.  You'll be amazed at how easy it is to tap
  285. the LaserJet III's power.
  286.  
  287.  
  288. NOTES ON DUPLEX PRINTING
  289.  
  290. There is a slight bug in the way that the Duplex printer driver works that
  291. I don't think can be fixed.  All I did to create the duplex driver is
  292. change the initial setup string to include commands to put the printer into
  293. duplex mode; Sprint really isn't aware of the concept of two sided
  294. printing.  Normally, this isn't a problem; most of the time Sprint can be
  295. blissfully unaware that pages are being printed on both sides of the paper
  296. and everything still works fine.  The one exception to this is when you
  297. print multiple copies of documents with an odd number of pages.
  298.  
  299. I'll explain by means of an example.  Let's say you have a document that is
  300. three pages long when printed on the LaserJet III, and you tell Sprint to
  301. print two copies of it.  Pages one and two of the first copy will be on the
  302. first piece of paper, and page three will be on the first side of the
  303. second piece of paper.  Okay so far.  Now for the fun part:  page one of the
  304. second copy will be on the second side of the second piece of paper!  The
  305. last page of the first copy and the first page of the second copy are on
  306. the same piece of paper, which is certainly not what you want.
  307.  
  308. I can't see a way around this.  There is no string that Sprint can be made
  309. to send at the end of each copy (which could be used to force the printer
  310. to eject the current piece of paper).  My way around this problem goes like
  311. this:  when I print multiple copies of a document with an odd number of
  312. pages, I just issue the print command several times, telling Sprint to
  313. print one copy each time.  This way, it resets the printer at the end of
  314. each copy, which fixes the problem.  Not very elegant, I'll admit, but it
  315. does work.  More creative types can probably think up an editor macro or
  316. something that might work better.  You could also insert an Escape command
  317. at the tail end of your document that would force a formfeed.
  318.  
  319.  
  320. NOTES ON SELECTING FONTS
  321.  
  322. The LaserJet III provides (and this printer driver supports) four different
  323. font families: Courier, LinePrinter, Times, and Univers.
  324.  
  325. Courier is your standard monospaced typewriter-like font available in only
  326. two sizes, 10 or 12 point (this printer driver only supports the 12 point
  327. size).  It has standard, bold, and italic (just a slanted version of the
  328. base typeface).  There is no bold italic.  In this printer driver, the font
  329. is named Courier10 and Courier12, each reflecting its size.
  330.  
  331. LinePrinter is a monospaced OCR-like font, available only in squinty 8.5
  332. point.  It includes neither bold nor italics.  Its font name in this driver
  333. is LinePrinter.
  334.  
  335. These first two font families will fail miserably with the typeset
  336. enhancements provided by this printer driver.  If you have to use these
  337. fonts in a document using the HPLJ-III.FMT file for formatting, I'd suggest
  338. using the @notct() around all of it to keep the formatter from trying to
  339. pretty it up.
  340.  
  341. The monospaced fonts will print at 6 lines per inch unless you specify
  342. different line spacing (e.g., in a ruler, via Layout/Ruler/Line Spacing/Other:
  343. 8.5pt for LinePrinter, 10pt for Courier10).  Too bad Sprint won't make the
  344. adjustment automatically.
  345.  
  346. CG Times is a beautiful, classic rendering of the quintessential serif font. 
  347. It is proportional and scalable.  It has a standard typeface, a real italic
  348. typeface with curly serifs, a fairly thick bold typeface, and a bold
  349. italic.  This printer driver renders it by default in 12 point, six lines
  350. per inch, but you can get Sprint to scale it to just about any size you
  351. want (more on that subject in the next section).  This driver's name for
  352. the font is simply Times, without an indication of size, since it can be
  353. made any size you could conceivably want.
  354.  
  355. Finally, Univers is a proportional, scalable, businesslike sans serif font. 
  356. It is about the same as what most printers call Helvetica.  It has a
  357. standard typeface, a bold, an italic (just a slanted version of the
  358. standard face, which is to be expected in a sans serif font), and a bold
  359. italic.  It also defaults to 12 point, 6 lines per inch.  This driver calls
  360. it Helvetica for compatibility with PostScript and other drivers.  This is not
  361. to say the font really IS Helvetica; the name is trademarked, and CompuGraphic
  362. (the CG of CG Times) didn't license the use of the name or the associated font.
  363.  
  364.  
  365. NOTES ON USING SCALABLE FONTS (THE 1800 DPI LIE)
  366.  
  367. The good news is that the LaserJet III provides two proportional, scalable
  368. fonts that can be made to be any type size you'd ever want.  The further
  369. good news is that Sprint supports scalable fonts such as these.  The bad
  370. news is that, with most LaserJet III drivers, it doesn't support them very
  371. well.
  372.  
  373. To understand what I'm talking about, let's delve into proportional spacing
  374. tables for a bit.  Monospaced fonts, such as Courier, are very easy for
  375. both the printer and the software to deal with, because all characters are
  376. exactly the same width, including spaces.  It's easy to know the width of a
  377. given character because they're all the same.  Proportional fonts, on the
  378. other hand, are a completely different ball game.  Every character in a
  379. proportional font has a variable width, listed in the printer driver in
  380. units known as HPIs.  An HPI (Horizontal Printer units per Inch) unit is
  381. defined as the minimum amount of space that a printer can move its print
  382. head horizontally.  (A laser printer doesn't really have a print head, but
  383. it does in a conceptual way.  There is a "point" that can be manipulated
  384. through software that determines where the next thing printed will be.)  It
  385. turns out that this is usually the same thing as the printer's resolution,
  386. as is the case here.  As a lot of people know, the resolution of almost all
  387. laser printers is 300 dpi, or dots per inch.  So there are 300 HPI units per
  388. inch on the LaserJet III.
  389.  
  390. A Times lower-case j in 12 points is 14 HPI units wide, and this is the way it
  391. would be listed in a 12-point PST table, as is the case with most LaserJet
  392. III drivers.  If you're working in 12 point, no translation is required at
  393. all and everything's great.
  394.  
  395. Now, let's suppose you tell Sprint to scale the size up to 24 point.  There
  396. isn't a separate PST table for 24 point times (and no provision to add
  397. one), so it has to extrapolate from the 12 point information.  24 point
  398. type is twice as big as 12 point, so it will multiply by 2 and determine
  399. that a Times lower-case j is 28 HPIs wide.  At 24 points, Sprint will get
  400. the width right for every character, most likely.
  401.  
  402. Now, let's imagine a trickier case.  You tell Sprint to size down to 10
  403. points.  Again, it has to extrapolate the width of 10 point characters from
  404. its 12 point information.  This time, it figures out that 10 points is
  405. 83.333333(repeating) percent of 12 points.  Already, we've got rounding
  406. errors.  Let's say it decides to use 83.33 percent as its scaling factor. 
  407. It multiplies 14 (the width of a lower-case j in 12 points, remember) by
  408. .8333 and gets 11.6662.  The width of a character has to be an integer,
  409. however, you can't print something that's a fractional number of pixels, so
  410. it rounds up, and rather nervously comes up with the value 12.  Maybe it
  411. got the same answer as the LaserJet III did, and maybe it didn't.
  412.  
  413. Actually, Sprint gets a surprising number of the scalings just right, given
  414. how much it has got working against it -- it may well have some trick up
  415. its sleeve I don't know about -- but it inevitably gets a few of them
  416. wrong.  The result is that Sprint is working with bad information, and you
  417. know the old computer truism:  garbage in, garbage out.  If you're asking
  418. Sprint to do tough things (in a type size that it has had to make a lot of
  419. bad extrapolations for) that require exact spacing, like justified right
  420. margins, kerning, and underlining, then it will make subtle to not so
  421. subtle mistakes.
  422.  
  423. Hewlett-Packard realized that this would be a sticky situation for a lot of
  424. software and so introduced a neat setup called AutoFont, where it supplies
  425. some files so that applications can get information necessary to work out
  426. exact character widths.  WordPerfect can do this, for instance.  Alas,
  427. AutoFont support is one of many modern-day word processing conveniences
  428. that Sprint doesn't have.
  429.  
  430. Actually, the situation isn't as bad as I've made it sound.  If you're
  431. using large typefaces for headlines and titles and such, and those titles
  432. are usually centered between the left and right margins (and not right
  433. justified), then you probably won't notice any spacing errors, even if you
  434. look for them.  On the other hand, if Sprint is trying to justify and kern
  435. 10 point type from 12 point spacing tables, the result is, in my opinion,
  436. unacceptable.  Go down to 8 point type and you have an unimaginable mess.
  437.  
  438. Enter LaserJet III Printer Driver Technology, Mark II, a term I just made
  439. up this second.  After chatting with some other Sprint users on Borland's
  440. Sprint forum, it became obvious that those users with PostScript output
  441. devices weren't having the same problems as those of us that are LaserJet
  442. users.  I did some digging and discovered that the trick was that the
  443. PostScript driver "lies," telling Sprint that PostScript devices can do
  444. 1800 dpi!  Before Sprint prints anything else, a PostScript file is sent
  445. along to the printer saying, in effect, "That Sprint is a horrible
  446. braggart, all the numbers it's going to send you will be six times larger
  447. than they should be, so scale them down."  Since Sprint thinks it's
  448. printing in 1800 dpi, the PostScript PST tables have values that are all
  449. six times greater than if they were specified for 300 dpi.  The practical
  450. upshot is far smaller scaling errors; so small, in fact, as to be
  451. unnoticeable.
  452.  
  453. The skeptics on the Sprint forum said I couldn't get away with this lie
  454. about the LaserJet III for the simple reason that the printer itself can't
  455. be told to compensate for Sprint's overenthusiasm.  It has no PostScript
  456. "smarts."  Pshaw, I said; and here is the result.
  457.  
  458. The way I manage the 1800 dpi magic with the LaserJet is that I account for
  459. the lie in the printer driver itself, rather than making the printer do it. 
  460. Sprint sends numbers to the printer driver (in HPIs and VPIs) indicating
  461. how far it wants the print head to move; my driver scales them down by a
  462. factor of six.  At most, the movement command will be off by only 5/300ths
  463. of an inch; the errors aren't cumulative as it goes along the line, either. 
  464. Sprint sends size information in HPIs which must be converted to point
  465. sizes when selecting fonts; my driver applies a formula that works at 1800
  466. dpi with no scaling errors whatever for any point size between 1 and 500 or
  467. more.  (The formula is trivially simple: divide the numbers Sprint sends by
  468. 25.)  It's that simple.  Then I multiplied all the values in my PST tables
  469. (which used to be for 12 point type) by 6, in effect making them 72 point
  470. tables.
  471.  
  472. The result is DRAMATICALLY cleaner output with small point sizes than any
  473. other LaserJet III driver I've ever seen.  Most drivers have PST tables
  474. optimized for 12 points and so produce perfect output at that size.  At 10
  475. points, most drivers start to have problems, especially with underlines. 
  476. Six points is unusable.  With my driver, there are very few noticeable
  477. scaling errors, all the way down to 4 points (the lowest size available built
  478. into the LaserJet III)!
  479.  
  480. In fact, my driver could be made even better, probably good enough that I
  481. could claim absolutely no visible scaling errors in any size type, ever.  I
  482. think that would be possible if I had the "real" width values for 72 point
  483. type.  As it is, I took my values for 12-point type and multiplied them by
  484. six.  If you think about that for a minute, you'll realize I haven't really
  485. made 72-point widths, I've just magnified my 12-point values, and it's
  486. "empty magnification" at that.  This increases the "granularity" of my fake
  487. 72-point widths, thereby introducing scaling errors.
  488.  
  489. I've been making up my own PST tables up to now (as described in Printer
  490. Driver Tools later on in this file), but there's no way my methods would
  491. work for 72-point type.  The widths aren't in the Technical Reference manual
  492. (free to LaserJet III owners who send the request card from the User's Manual)
  493. either, but they are in the developer's kit, which I'm getting from Agfa
  494. CompuGraphic.  (Apparently the widths don't scale linearly (so 12-point widths
  495. aren't one-sixth of the 72-point widths), so the jury's still out on how much
  496. this driver can be improved.)
  497.  
  498. As usual, I am amazed at how utterly and completely customizable Sprint
  499. really is.  (It's just too bad the original designers didn't think of my
  500. scaling trick.)  Hats off to what has to be the most easily programmable
  501. word processor in the world.
  502.  
  503. Now, it's up to other Sprint users to take this trick and use it for other
  504. printers.  I am absolutely certain that it will work for every single 300 dpi
  505. output device with scalable fonts that Sprint currently supports or can
  506. be made to support.  If you're interested, I'll be glad to give advice.
  507.  
  508.  
  509. NOTES ON QUOTATION MARK TRANSLATION
  510.  
  511. You can use "double quotation marks" and `single quotation marks' (also known
  512. as backquote and apostrophe) and HPALLEN.TCT will substitute publication-
  513. quality marks (the ones that look like tiny superscripted 66 and 99, or 6
  514. and 9).  For the cases it doesn't do what you want, you can force the 66-style
  515. quote via `` and the 99-style via ''.  You can even force the typewriter-like
  516. double quote symbol " via the little-used IBM-extended-ASCII character
  517. 247 decimal (≈, squiggly equal-sign), which you can assign to a Sprint editor
  518. macros if you like for easier insertion.  Or you can insert my macro names:
  519. @Qop and @Qcl are the double open and close quote macros, and @Sop
  520. and @Scl are the single open and close quote macros.  Finally, could also
  521. put the ugly straight up and down quotes from the PC-8 character set into
  522. your document by using a @notct command.  Putting @notct(") in a Sprint
  523. document would get you the raw double quote and @notct(') would print the
  524. raw single quote.
  525.  
  526.  
  527. NOTES ON KERNING
  528.  
  529. In case you're not familiar with the term, "kerning" means removing the
  530. extra space between some character pairs in proportional fonts.  For
  531. instance, when a proportional upper-case A is printed right next to an
  532. upper-case V without kerning, your eye tells you that they aren't close
  533. enough together.  This is because of all the space at the top of the A and
  534. the bottom of the V.  All the standard kerning pairs are listed in @tct
  535. translations in HPALLEN.TCT.  Kerning works pretty well in Sprint, but it
  536. isn't perfect.  There are two main problems that crop up, both of which I
  537. will explain.
  538.  
  539. The first is the occurrence of two kerning pairs right next to each other. 
  540. WA is a kerning pair, and so is AV.  But let's say you write about an
  541. organization called World Aviary Venue, and so end up with WAV in your
  542. documents.  The W and A will get kerned together, but the A and V will not!
  543.  
  544. To fix this, you could look at the values in the original @tct
  545. definitions for both pairs concerned:
  546.  
  547. @tct('WA' 'W@hsp(-0.10 em)A')
  548. @tct('AV' 'A@hsp(-0.14 em)V')
  549.  
  550. and make a new kerning "triplet," like this:
  551.  
  552. @tct('WAV' 'W@hsp(-0.10 em)A@hsp(-0.14 em)V')
  553.  
  554. Okay, that solves that problem, but it gets worse.  An abbreviation I use
  555. in some of my documents is PAVO.  In this case, the P and A get kerned
  556. together and the V and O get kerned together, but the A and V don't!  So I
  557. had to define a kerning "fourplet" to take care of it.
  558.  
  559. It would have been impossible for me to define all possible kerning
  560. triplets and fourplets in HPALLEN.TCT; there are just too many.  For
  561. that matter, some people may use letter combinations that would require
  562. fiveplets, sixplets, sevenplets . . . you get the idea.
  563.  
  564. The other kerning problem involves soft hyphens.  The @tct command will
  565. not translate a kerning pair of letters if a soft hyphen comes between
  566. them.  However, if you look at the list of kerning pairs, you will see that
  567. the likelihood of a syllable breaking between any of them is very small.
  568.  
  569.  
  570. NOTES ON LIGATURES
  571.  
  572. In case this term is new to you, a ligature (in publishing parlance) is a
  573. special combination character that can be printed instead of two or three
  574. other characters.  The five ligature combinations are fi, fl, ff, ffi, and
  575. ffl.  For instance, the fi ligature looks like an f and an i printed very
  576. close together, with the upper part of the f hanging down over the i and
  577. replacing its dot.  You sometimes see ligatures in high quality hardback
  578. books (they are almost never included in paperbacks).
  579.  
  580. Ligatures are handled pretty much automatically in Times and Univers; you
  581. don't have to type anything different in your documents than you ever have. 
  582. Sprint will automatically convert the proper letter pairs and triplets into
  583. the proper ligatures.  (Ligatures won't work in Courier or LinePrinter,
  584. however, under any circumstances.)  One thing to note is that fi and fl
  585. don't meld together in Univers; the only real ligature in this font is ff. 
  586. This isn't a limitation of this printer driver, Sprint, or the LaserJet
  587. III; it's just the way the font was designed.  If you print out the test
  588. document HPLJ-III.SPR, I think you'll agree the font designer made the
  589. right choice there.
  590.  
  591. One caveat, and it's a doozy: because of the way the Sprint @tct
  592. formatter command works, ligatures won't get translated if there is a soft
  593. hyphen between any of the characters.  This is really too bad, because a
  594. lot of words do indeed break right in the middle of a ligature combination.
  595.  
  596. The (sort of) good news is you can search for possible messed up ligature
  597. combinations easily inside Sprint.  Get to the Search menu (F10/Edit/
  598. Search-Replace).  Set Case Sensitive and Use Wildcards to YES; Match Words
  599. Only should be on NO.  (Entire File can be NO or YES, depending on how you
  600. want to search.)  Then pick Find, and use the following string:
  601.  
  602. f^^[fil]
  603.  
  604. Note that you'll see two carets on-screen, just as I've typed it, but what
  605. you must really put there is an ASCII 30 character.  To do that, hold down
  606. Alt, type 3 and 0 on your number pad, and then let go of Alt.  Although
  607. it's not immediately apparent, this string will find soft hyphens in all
  608. five ligature types.  Rather than try to explain why, just embed some soft
  609. hyphens inside all ligature types in your document and try it for yourself.
  610.  
  611. If you find any soft hyphens inside ligatures, you probably should remove
  612. them--but what if Sprint really needs to break a line there?  I hate
  613. that.  The final decision is yours.
  614.  
  615.  
  616. NOTES ON EM-DASH TRANSLATION
  617.  
  618. There's not really much to say about this.  If Sprint sees two dashes
  619. together in your document like this--it will instead print one long em-
  620. dash, about the length of an upper-case M, the way it's done in most books. 
  621. If it sees only one dash, like this - it will print a regular short dash. 
  622. If it sees four dashes in a row, like this ----, it will print two em
  623. dashes.  And so on.  If you don't want the translation to occur for a
  624. particular pair of dashes, you could type @notct(--) instead, or put a soft
  625. hyphen between the two dashes to keep them from getting translated.
  626.  
  627.  
  628. NOTES ON MICROSOFT PUBLISHING BULLETS
  629.  
  630. Since I was including characters from the Microsoft Publishing character
  631. set anyway, I said hey, what the heck, why not include all those neat
  632. bullets?  You can include them in your documents with @pub[@char(xxx)],
  633. where xxx is the ASCII code of the character you want.  See HPLJ-III.SPR
  634. for examples of the bullets and their ASCII codes.  You can also include
  635. them in format definitions.  For instance, the new definition for the
  636. Bullets list type in EXTRA.FMT uses two of these bullets.  Similarly, you can
  637. get characters from the Legal or Roman-8 symbol sets by using @lgl() or @r8();
  638. e.g., HPALLEN.TCT translates (C) documents to @lgl(^) so that a copyright
  639. symbol will be printed.
  640.  
  641.  
  642. PRINTER DRIVER TOOLS
  643.  
  644. As I've mentioned earlier in this file, I wrote this driver due to
  645. dissatisfaction with other LaserJet III drivers I've downloaded.  One of
  646. my chief gripes about those other drivers is incomplete or inaccurate PST
  647. tables.  So, starting from a method described in the Sprint Advanced User's
  648. Guide, Appendix F, I decided to write my own tables.  However, I feel I came up
  649. with a better method, one which doesn't require measuring, and also allows
  650. you to be ABSOLUTELY CERTAIN you've gotten the values correct, down to the
  651. last pixel.
  652.  
  653. I started with the same basic method described in the Advanced User's
  654. Guide, and created a document (with a Sprint editor macro) that contains
  655. long lines of all the ASCII characters.  I added this crucial step: I also
  656. underlined all the characters.  So what?, you say.  Well, I'll tell you why
  657. that helps.
  658.  
  659. By default, Sprint performs underlining in a very strange way.  First, it
  660. prints the characters to be underlined, then it backspaces and prints a
  661. long line of underscore characters under them.  There's one problem so far,
  662. and that is that an underline would always have to be a length that's a
  663. multiple of the length of the underscore character; you can't print half an
  664. underscore or a third of one or whatever.  So, to get the right edge of the
  665. underline exactly where it wants it, Sprint usually repositions the print
  666. head a little bit to the left and then prints one final underscore
  667. character.  Here's the useful part:  This method WON'T WORK properly unless
  668. Sprint knows the EXACT width of the characters it's underlining, and all
  669. the characters that came before that on the line!
  670.  
  671. To exploit my method, you must install an older 300 dpi printer driver that
  672. doesn't "lie."  In the CompuServe distribution, I've included the file
  673. HPLJ-300.SPL, which works at 300 dpi and has PST tables for 12-point type.
  674. It installs just like the real driver, but it must be renamed to HPLJ3J.SPL
  675. (or the definition in your MAIN.SPL file must be changed) before you can
  676. install it.
  677.  
  678. The file I made up to perform this magic is called PSTWIDTH.SPR, included on
  679. the CompuServe distribution.  It contains sections for regular, bold,
  680. italic, and bold italic type, and then for the characters I use out of the
  681. Microsoft Publishing character set.  To demonstrate my method, install the
  682. 300 dpi printer driver given here and then print the first couple of pages
  683. of the file.  Make SURE you're using STANDARD.FMT when you print it, and NOT
  684. HPLJ-III.FMT; that would cause all kinds of translations to be done that you
  685. don't want at this point.
  686.  
  687. You'll see lines of most all of the characters in the set in Times, printed
  688. along with their ASCII value.  (You can exercise the Univers font family if
  689. you want by changing the FONT command at the top of the file.)  Each line
  690. of characters begins and ends with an ASCII 205 line drawing character so
  691. you can see exactly where the line starts and ends, even for ASCII
  692. characters that are "invisible," such as the space.  Notice that each line
  693. of characters has a precise underline under it that begins and ends in
  694. exactly the right place.  Now, working with a backup copy of HPLJ3J.SPL,
  695. change the value of, say, the upper-case B by ONLY ONE DIGIT.  The table
  696. you need to change starts with a line that says "pst CGTimes12r".  Subtract
  697. one from its value, then reinstall the 300 dpi printer driver.  Print the
  698. first page of PSTWIDTH.SPR again, and notice that now the underline under
  699. the capital B's is a little bit too short!
  700.  
  701. This is how I can say with utter certainty that every single value in all
  702. my PST tables are absolutely correct for 12 point.  You can use
  703. PSTWIDTH.SPR for any possible font by changing the font name at the top of
  704. the file.  You can also use it to judge how much Sprint will be off when it
  705. has to scale to different point sizes.
  706.  
  707. A word of caution, however:  This method really doesn't work for the space
  708. character.  In fact, before you use this method, you really should already
  709. be pretty certain about the widths of the underline and space characters
  710. (in standard type, as opposed to italic or bold); fortunately, the flawed
  711. drivers I started with at least had these crucial widths correct.  It is
  712. possible for every character to seem to print perfectly in PSTWIDTH.SPR but
  713. your documents still won't justify correctly if the space value isn't
  714. right.  It seems like the underline under the space character should be too
  715. long or too short if that character isn't defined right, just like every
  716. other character, but it "escapes" somehow.  Maybe Sprint really doesn't
  717. print the space character at all, but just takes your word for its width
  718. and then moves the print head that far to the right.  As for the underline,
  719. well, obviously you need it to be right to test the widths of all the other
  720. characters.  It obviously cannot be used to test its own width.  If you
  721. were the really hardcore type, I guess you could print to disk and examine
  722. the codes in the print file and stuff--in fact, printing to disk was how
  723. I discovered Sprint's weird underline method--but I can't give you any
  724. further advice, because I've never had to do this.  If you're unfortunate
  725. enough to have to create a PST table completely from scratch, well, I
  726. sympathize; I hope you work something out.  Guessing can't hurt.
  727.  
  728. Getting all the PST values exactly right in all those tables is a long and
  729. extremely tedious process.  Basically, it's print out a listing, make the
  730. values a little smaller where the underline is too long, make the values a
  731. little bigger where the underline is too short, reinstall the printer
  732. driver, print out another listing, make the values a little smaller . . .
  733. and so on and so on, ad infinitum.  After all that, I had to multiply all
  734. my values by 6 to make my 12 point tables become 72 point tables.  All of
  735. this isn't for the feint of heart.  I'd guess I've spent at least 30 hours
  736. on this printer driver.  If I'd known it would take that long when I
  737. started, I probably would have run, screaming, into some other word
  738. processor camp.
  739.  
  740. Another, simpler tool I put together was a conversion table for the cryptic
  741. PST codes to ASCII codes.  When specifying the width of given characters in
  742. PST tables, it's easy for the normal printing characters; for 12-point
  743. tables, you just put the character itself, a number that represents its
  744. width (in 1/300ths of an inch on the LaserJet III), and a comma, and go on
  745. to the next character.  When you get to the upper ASCIIs, however, things
  746. get a little more exciting.  For instance, you have to specify ~^\ for
  747. ASCII code 156.  Who can remember (or even figure out) that kind of stuff? 
  748. One of the things I didn't like about all the other printer drivers was
  749. that almost none of them had values for every single ASCII character from
  750. 32 to 255, so I really needed a conversion table.
  751.  
  752. So, PSTCODES.SPR is a modified PST table that has ASCII values where most
  753. tables have width values.  I printed it out and use it as a reference while
  754. performing printer driver maintenance.
  755.  
  756.  
  757. RELEASE INFORMATION AND VERSION HISTORY
  758.  
  759. This is the first public release of this driver by me, version 1.0, first
  760. distributed on June 28, 1991.  I give it freely to the Sprint community,
  761. without any strings attached.  (God knows, what with the support it's
  762. getting from Borland, Sprint and its users can use all the help they can
  763. get.)  Use it, don't use it, distribute it, cannibalize it, whatever, I
  764. don't care.  I would particularly like to see someone take this technique
  765. and customize it for other types of printers, like the LaserJet IIIP.
  766.  
  767. My only caveat is this:  I don't want to be praised or blamed for your work. 
  768. If you change this driver and upload it somewhere else, don't include this
  769. document; write your own.  That would be like stealing my voice.  You can
  770. say you based your driver on mine, but that's it.  Do me at least this
  771. favor.  Don't make me sorry I gave this thing away.
  772.  
  773. [[This is Jim speaking now:  I made some changes and am uploading my version
  774. only with revising this file, not rewriting it from scratch.  Allen and I
  775. have both spent lots of time developing these drivers, and have exchanged a
  776. fair amount of electronic mail about them; I think all Sprint users with
  777. LaserJet III-compatible printers benefit.  But I sure don't want to make
  778. Allen sorry about sharing his efforts with the Sprint community!  If you use
  779. this version, feel free to ask me about it.  If you want to ask Allen,
  780. please try out his version first; you can download it from the Sprint
  781. section of CompuServe's BorApp forum.  Back to Allen:]]
  782.  
  783. Now that I'm hip deep in this thing, there are a bunch of changes I plan to
  784. make or attempt.  First off, I think it may be possible to perform the
  785. scaling magic of this driver without lying to Sprint about the printer's
  786. resolution.  The Sprint Advanced User's Guide says that when using PSTs for
  787. a font, you can tell Sprint what size type the PST is for.  I tried this;
  788. the basic approach was, Hey, this is a 300 dpi device, I want you to print
  789. in 12 point by default, but the PSTs I'm giving you are for 72 point type. 
  790. It didn't work.  I may have done something wrong.  Then I thought, Well, I
  791. can still lie about the horizontal dimensions but tell the truth about the
  792. vertical ones, since the VPIs don't present a problem.  That didn't work
  793. either; again, it could have been "operator error."  I admit I rushed this
  794. driver out so as prove the skeptics wrong.  So shoot me for having a big
  795. ego.
  796.  
  797. I plan on adding support for the LaserJet III's envelope feeder.  I'm going
  798. to try to get the proportional fonts to work in landscape mode, in
  799. particular so I can print Times on envelopes.
  800.  
  801. I really should have defined widths for all the characters in the Microsoft
  802. Publishing character set, instead of lazily defining only those I saw an
  803. immediate need for.  But by the time I decided I wanted to use it, I was
  804. sick to DEATH of making up PSTs.  It is horrendously gruesome and time
  805. consuming work.
  806.  
  807.  
  808. THE AUTHOR REQUESTS FEEDBACK, IDEAS, THROWN TOMATOES, ET CETERA
  809.  
  810. I learned a lot about Sprint by writing this driver.  I have gotten a lot
  811. of help on CompuServe from Borland representatives and other Sprint users. 
  812. I'd be interested in hearing any comments you might have (I'd suggest
  813. leaving them in the Sprint forum; GO BORAPP at a CompuServe ! prompt). 
  814. I'll answer questions if you ask nicely.
  815.  
  816. If you modify this thing for (or use my "1800 dpi lie" idea for) another
  817. type of printer, I'd like to see the result.  If you have information
  818. pertaining to 72-point PST values for the LaserJet III, I'd REALLY like to
  819. hear from you!  If so, do us both a favor by giving me the last thing I
  820. need to make a near perfect LaserJet III driver for everybody.
  821.  
  822. Comments to:
  823.     Allen Brunson, CompuServe 76676,2650
  824.     Jim Celoni, S.J., Internet celoni@cunixf.cc.columbia.edu
  825.